php remove last character from string if comma

124

remove last comma from string php -

rtrim($my_string, ',');

php remove last character from string if comma -

$string = rtrim($string, ',');

php substr remove last 4 characters -

echo substr($string, 0, -3);

Comments

Submit
0 Comments